
using System;
using AtDevice;
using GLib;

namespace GtkMokkula
{
    
    
    public partial class MainWindow : Gtk.Window
    {

        public MainWindow() : 
                base(Gtk.WindowType.Toplevel)
        {
            AddLogFunctions();
            this.Build();
            new GtkControls.TrayIcon(this);
        }
        
        private void AddLogFunctions()
        {
            GLib.LogFunc logFunc = new GLib.LogFunc (GLib.Log.PrintTraceLogFunction);
            GLib.Log.SetLogHandler("Gtk", GLib.LogLevelFlags.Critical, logFunc);
            GLib.Log.SetLogHandler("GLib", GLib.LogLevelFlags.Critical, logFunc);
            GLib.Log.SetLogHandler("GLib-GObject", GLib.LogLevelFlags.Critical, logFunc);    
        }

        protected virtual void OnDeleteEvent (object o, Gtk.DeleteEventArgs args)
        {
            DeviceHandler.Close();
            Gtk.Application.Quit();
        }
    }
}
